<!DOCTYPE html>
<html class="layui-bg-white">
<head th:include="include :: header"></head>
<body>
<div class="layui-form" style="padding:20px;">
    <input type="hidden" id="subjectName" name="subjectName">
    <div class="layui-form-item">
        <label class="layui-form-label"><span class="required">*</span>科目：</label>
        <div class="layui-input-block">
            <select lay-filter="subjectId" id="subjectId" name="subjectId" class="form-control chosen-select" lay-search lay-verify="required">
                <option value="">--请选择--</option>
                <option th:each="item : ${subject}" th:value="${item.id}" th:text="${item.name}"></option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><span class="required">*</span>试卷名称：</label>
        <div class="layui-input-block">
            <input type="text" id="name" name="name" lay-verify="required" placeholder="请输入试卷名称" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">试题类型：</label>
        <div class="layui-input-block">
            <input type="radio" name="questionType" th:each="item:${questionType}" th:value="${item.value}" th:title="${item.name}" th:checked="${item.value=='1'}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">试卷类型：</label>
        <div class="layui-input-block">
            <input type="radio" name="type" th:each="item:${paperType}" th:value="${item.value}" th:title="${item.name}" th:checked="${item.value=='1'}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">试卷时间：</label>
        <div class="layui-input-block">
            <input type="text" id="paperDate" name="paperDate" placeholder="请选择试卷时间" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-row layui-form-item">
        <div class="layui-col-md6">
            <label class="layui-form-label">时间范围：</label>
            <div class="layui-input-block">
                <input type="text" id="timeRange" name="timeRange" placeholder="请选择时间范围" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-col-md6">
            <label class="layui-form-label">总时间：</label>
            <div class="layui-input-block">
                <input type="text" id="totalTime" name="totalTime" placeholder="请输入总时间（分钟）" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="LAY-operate-submit" id="LAY-operate-submit" value="确认">
    </div>
</div>
<div th:include="include :: footer"></div>
<script type="text/javascript">
    layui.config({
        base: ctx + '/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index'         //主入口模块
    }).use(['index', 'form', 'laydate'], function () {
        var $ = layui.$, form = layui.form, laydate = layui.laydate;

        form.verify(commonJs.form.verify);

        //科目
        form.on('select(subjectId)', function (data) {
            var value = data.value || '';
            var text = '';
            if (value != '') {
                text = data.elem[data.elem.selectedIndex].text || '';
            }
            $('#subjectName').val(text);
        });

        laydate.render({
            elem: '#paperDate',
            value: new Date(),
            trigger: 'click'
        });

        laydate.render({
            elem: '#timeRange',
            type: 'time',
            range: true,
            trigger: 'click'
        });
    })
</script>
</body>
</html>